package br.com.pattern.dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * Classe respons�vel por fazar a conex�o com o
 * banco de dados PostgreSQL
 */
public class ConnectionDatabasePostgres extends ConnectionDataBaseGeneric{

	private static final String URL_MYSQL = "jdbc:postgresql://localhost:5432/scvpi";
	private static final String DRIVER_CLASS = "org.postgresql.Driver";
	private static final String USER = "postgres";
	private static final String PASS = "postgres"; 
	
	@Override
	public Connection getConnection() {
		
		System.out.println("Conectando ao Banco de Dados Postgres...");

		try {		
			Class.forName(DRIVER_CLASS);
			this.connection = DriverManager.getConnection(URL_MYSQL, USER, PASS);
			return this.connection;

		} catch (ClassNotFoundException e) {		
			e.printStackTrace();

		} catch (SQLException e) {		
			throw new RuntimeException(e);		
		}

		return null;
	}
}
